import 'xe-utils'
import VXETable from 'vxe-table'
import VXETablePluginAntd from 'vxe-table-plugin-antd'
import { getLocalSetting } from '@/utils/themeUtil'
import { ADMIN } from '@/config/default'

// 通用组件
import '@/components/zz/VxeTable'

// 引入erp组件
// import '@/components/erp/VxeTable'

// 引入修改过的vxe-table样式，适配框架换肤功能
const localSetting = getLocalSetting() || {}
const themeMode = ADMIN.theme.mode
const fileName = localSetting.theme && localSetting.theme.mode === themeMode.NIGHT ? 'night' : 'default'

// 根据默认主题加载对应表格主题
import(`../theme/vxe-table/${fileName}.scss`)

// 修改默认样式
import(`@/assets/css/vxe-table-common.scss`)
import 'vxe-table-plugin-antd/dist/style.css'

VXETable.use(VXETablePluginAntd, { size: 'default' })

// 全局默认参数
VXETable.setup({
  version: 0,
  zIndex: 999,
  table: {
    border: true,
    resizable: true,
    align: 'center',
    highlightHoverRow: true,
    showOverflow: true,
    showHeaderOverflow: true
  },
  grid: {
    size: 'small'
  }
})

// 将模态窗口挂载到 vue 实例中
// Vue.prototype.$XModal = VXETable.modal
export default VXETable
